package com.zcp.jiesuodemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity implements LockDemo.onPatterChangeListener {

    private TextView lockHint;
    private LockDemo lockDemo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        lockDemo= (LockDemo) findViewById(R.id.lock_view);
        lockHint= (TextView) findViewById(R.id.activity_main_lock_hint);
        lockDemo.setPatterChangeListener(this);
    }

    @Override
    public void onPatterChange(String pwd) {
        if(!TextUtils.isEmpty(pwd))
        {
            lockHint.setText(pwd);
        }else
            {
                lockHint.setText("至少5个图案");
            }
    }

    @Override
    public void onPatterStart(boolean isStart) {
        if(isStart)
        {
            lockHint.setText("请绘制图案");
        }
    }
}
